<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java" import="java.lang.*" %>
<html>
<head>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <title>Zen主页</title>
    <%
        String qinpkgs = request.getParameter("q_inpkgs");
        String qexpkgs = request.getParameter("q_expkgs");
        String qshowDetail = request.getParameter("q_showDetail");
        if (session.getAttribute("inpkgsHis") == null || "".equals(session.getAttribute("inpkgsHis"))) {
            session.setAttribute("inpkgsHis", System.getProperties().getProperty("inpkgs", ""));
        }
        if (session.getAttribute("expkgsHis") == null || "".equals(session.getAttribute("expkgsHis"))) {
            session.setAttribute("expkgsHis", System.getProperties().getProperty("expkgs", ""));
        }
        if (qinpkgs != null && !"".equals(qinpkgs)) {
            if (!qinpkgs.equals(System.getProperties().getProperty("inpkgs", "").equals("") ? "blank" : System.getProperties().getProperty("inpkgs", ""))) {
                if ("".equals(session.getAttribute("inpkgsHis"))) {
                    session.setAttribute("inpkgsHis", qinpkgs);
                } else {
                    session.setAttribute("inpkgsHis", session.getAttribute("inpkgsHis") + "<br>" + qinpkgs);
                }
            }
            if ("blank".equals(qinpkgs)) {
                System.setProperty("inpkgs", "");
            } else {
                System.setProperty("inpkgs", qinpkgs);
            }
        }
        if (qexpkgs != null && !"".equals(qexpkgs)) {
            if (!qexpkgs.equals(System.getProperties().getProperty("expkgs", "").equals("") ? "blank" : System.getProperties().getProperty("expkgs", ""))) {
                if ("".equals(session.getAttribute("expkgsHis"))) {
                    session.setAttribute("expkgsHis", qexpkgs);
                } else {
                    session.setAttribute("expkgsHis", session.getAttribute("expkgsHis") + "<br>" + qexpkgs);
                }

            }
            if ("blank".equals(qexpkgs)) {
                System.setProperty("expkgs", "");
            } else {
                System.setProperty("expkgs", qexpkgs);
            }
        }

        if (qshowDetail != null && !"".equals(qshowDetail)) {
            System.setProperty("showDetail", qshowDetail);
        }
        String inpkgs = System.getProperties().getProperty("inpkgs", "");
        String expkgs = System.getProperties().getProperty("expkgs", "");
        String showDetail = System.getProperties().getProperty("showDetail", "");
    %>
    <script type="text/javascript">
        function init() {
            var showDetail = "<%=showDetail %>";
            showDetail = showDetail.toUpperCase();
            if("Y"==showDetail||"TRUE"==showDetail||"1"==showDetail){
                document.getElementById("showDetailTure").checked=true;
            }else {
                document.getElementById("showDetailFalse").checked=true;
            }
        }
    </script>
</head>
<body onload="init()">
<form action="index.jsp" method="post">
    <table>
        <tr>
            <td><label>inpkgs参数:</label></td>
            <td colspan="3"><input type="text" id="q_inpkgs" name="q_inpkgs" value="<%=inpkgs %>" style="width: 1200px">
            </td>
        </tr>
        <tr>
            <td><label>expkgs参数:</label></td>
            <td colspan="3"><input type="text" id="q_expkgs" name="q_expkgs" value="<%=expkgs %>" style="width: 1200px">
            </td>
        </tr>
        <tr>
            <td><label>是否显示详情:</label></td>
            <td colspan="3">
                <input type="radio" id="showDetailTure" name="q_showDetail" value="Y" />是
                <input type="radio" id="showDetailFalse" name="q_showDetail" value="N"/>否
            </td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td><input type="submit" value="提交"></td>
        </tr>
    </table>
</form>

<b>【参数值】</b><br>
<table border="1">
    <tr>
        <th>参数名</th>
        <th>参数值</th>
    </tr>
    <tr>
        <td>inpkgs:</td>
        <td><%=inpkgs.replace(";", "<br>") %>
        </td>
    </tr>
    <tr>
        <td>expkgs:</td>
        <td><%=expkgs.replace(";", "<br>") %>
        </td>
    </tr>
    <tr>
        <td>showDetail:</td>
        <td><%=showDetail %>
        </td>
    </tr>
</table>
<br>
<br>
<b>【参考说明】</b><br>
<table border="1">
    <tr>
        <td colspan="2"><b>inpkgs:</b>该参数是设置全类名匹配的表达式，只有调用堆栈链里匹配到一个及以上的结果就表示打印堆栈痕迹和SQL<br>
            <b>expkgs:</b>该参数是设置全类名匹配的表达式，只要是调用堆栈链里匹配到一个结果就不打印打印堆栈痕迹和SQL<br>
            <b>showDetail:</b>是否显示每个SQL动态参数对应的是JavaType，执行的set方法等
        </td>
    </tr>
    <tr>
        <th>包名通配符</th>
        <th>通配符说明</th>
    </tr>
    <tr>
        <td>com.aaa.idc.*;</td>
        <td>匹配包com.aaa.idc下的所有类;</td>
    </tr>
    <tr>
        <td>com.aaa.idc.rs.*.dao.*;</td>
        <td>匹配包com.aaa.idc.rs下所有dao子目录的类;</td>
    </tr>
    <tr>
        <td>com.aaa.ida40.ifap.*.*Msg*;</td>
        <td>匹配包com.aaa.ida40.ifap下所有类名或方法名包含Msg的类和方法;</td>
    </tr>
    <tr>
        <td>com.aaa.ida40.ifap.*.*Filter;</td>
        <td>匹配包com.aaa.ida40.ifap下所有类名有Filter;</td>
    </tr>
    <tr>
        <td>!com.aaa.idc.*;</td>
        <td>不匹配包com.aaa.idc下的所有类;</td>
    </tr>
    <tr>
        <td>*;</td>
        <td>匹配所有类和方法。</td>
    </tr>
    <tr>
        <td>blank;</td>
        <td>设置参数为空值。匹配空值。</td>
    </tr>
</table>
<br><br><br>
<label><b>inpkgs参数痕迹记录：</b></label><br>
<label>${sessionScope.inpkgsHis}</label><br>
<label><b>expkgs参数痕迹记录：</b></label><br>
<label>${sessionScope.expkgsHis}</label><br>
</body>
</html>
